import { createApp } from 'vue'
import App from './App.vue'
import router, { restoreDynamicRoutes } from './router'
import './style.css'

// 在应用启动前恢复动态路由
const accessToken = localStorage.getItem('accessToken')
if (accessToken) {
    const menusJson = sessionStorage.getItem('userMenus')
    if (menusJson) {
        console.log('main.js: 应用启动，立即恢复动态路由')
        restoreDynamicRoutes()
    }
}

const app = createApp(App)
app.use(router)
app.mount('#app')